// 本文件由自动工具 proto.py 自动生成，请勿修改
// filename msg3000_csbuf.ts
// package ptl


// message RoomPlayerInfo
export class RoomPlayerInfo {
	protoid: number = 0;
	playerId: string = "";
	playerName: string = "";
	gender: number = 0;
	addr: string = "";
	image: string = "";


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setString(this.playerName, 2)
	writer.setUint8(this.gender, 3)
	writer.setString(this.addr, 4)
	writer.setString(this.image, 5)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.playerName = reader.getString(2)
	this.gender = reader.getUint8(3)
	this.addr = reader.getString(4)
	this.image = reader.getString(5)
}
}

// message RoomRule
export class RoomRule {
	protoid: number = 0;
	key: number = 0;
	value: number = 0;
	param: number = 0;


Marshal(writer: any) {
	writer.setUint8(this.key, 1)
	writer.setUint8(this.value, 2)
	writer.setUint16(this.param, 3)
}

Unmarshal(reader: any) {
	this.key = reader.getUint8(1)
	this.value = reader.getUint8(2)
	this.param = reader.getUint16(3)
}
}

// message RoomInfo
export class RoomInfo {
	protoid: number = 0;
	roomId: number = 0;
	owner: string = "";
	playerLimit: number = 0;
	players: RoomPlayerInfo[] = [];
	rules: RoomRule[] = [];
	total: number = 0;
	count: number = 0;
	type: number = 0;
	createTime: number = 0;


Marshal(writer: any) {
	writer.setUint32(this.roomId, 1)
	writer.setString(this.owner, 2)
	writer.setUint8(this.playerLimit, 3)
	writer.setArray(this.players.length, 4)
	for (let v of this.players) {
		writer.setMessage(0)
		v.Marshal(writer)
		writer.endSetMessage()
	}
	writer.setArray(this.rules.length, 5)
	for (let v of this.rules) {
		writer.setMessage(0)
		v.Marshal(writer)
		writer.endSetMessage()
	}
	writer.setUint16(this.total, 6)
	writer.setUint16(this.count, 7)
	writer.setUint8(this.type, 8)
	writer.setInt64(this.createTime, 9)
}

Unmarshal(reader: any) {
	this.roomId = reader.getUint32(1)
	this.owner = reader.getString(2)
	this.playerLimit = reader.getUint8(3)
	let countPlayers = reader.getArray(4)
	for (let i=0; i < countPlayers; i++) {
		let msg = new RoomPlayerInfo()
		reader.getMessage(0)
		msg.Unmarshal(reader)
		reader.endGetMessage()
		this.players.push(msg)
	}
	let countRules = reader.getArray(5)
	for (let i=0; i < countRules; i++) {
		let msg = new RoomRule()
		reader.getMessage(0)
		msg.Unmarshal(reader)
		reader.endGetMessage()
		this.rules.push(msg)
	}
	this.total = reader.getUint16(6)
	this.count = reader.getUint16(7)
	this.type = reader.getUint8(8)
	this.createTime = reader.getInt64(9)
}
}

// message CreateRoomRet
export class CreateRoomRet {
	protoid: number = 3000;
	playerId: string = "";
	roomId: number = 0;
	addr: string = "";
	secret: string = "";
	model: number = 0;


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setUint32(this.roomId, 2)
	writer.setString(this.addr, 3)
	writer.setString(this.secret, 4)
	writer.setUint8(this.model, 5)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.roomId = reader.getUint32(2)
	this.addr = reader.getString(3)
	this.secret = reader.getString(4)
	this.model = reader.getUint8(5)
}
}

// message CheckRoomRet
export class CheckRoomRet {
	protoid: number = 3010;
	ret = new CreateRoomRet();


Marshal(writer: any) {
	writer.setMessage(1)
	this.ret.Marshal(writer)
	writer.endSetMessage()
}

Unmarshal(reader: any) {
	reader.getMessage(1)
	this.ret.Unmarshal(reader)
	reader.endGetMessage()
}
}

// message Req3001
export class Req3001 {
	protoid: number = 3001;
	playerId: string = "";
	type: number = 0;
	rules: RoomRule[] = [];
	playerLimit: number = 0;
	gem: number = 0;
	token: string = "";


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setUint8(this.type, 2)
	writer.setArray(this.rules.length, 3)
	for (let v of this.rules) {
		writer.setMessage(0)
		v.Marshal(writer)
		writer.endSetMessage()
	}
	writer.setUint8(this.playerLimit, 4)
	writer.setUint8(this.gem, 5)
	writer.setString(this.token, 6)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.type = reader.getUint8(2)
	let countRules = reader.getArray(3)
	for (let i=0; i < countRules; i++) {
		let msg = new RoomRule()
		reader.getMessage(0)
		msg.Unmarshal(reader)
		reader.endGetMessage()
		this.rules.push(msg)
	}
	this.playerLimit = reader.getUint8(4)
	this.gem = reader.getUint8(5)
	this.token = reader.getString(6)
}
}

// message Req3002
export class Req3002 {
	protoid: number = 3002;
	playerId: string = "";
	roomId: number = 0;
	token: string = "";


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setUint32(this.roomId, 2)
	writer.setString(this.token, 3)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.roomId = reader.getUint32(2)
	this.token = reader.getString(3)
}
}

// message Req3003
export class Req3003 {
	protoid: number = 3003;
	playerId: string = "";
	playerName: string = "";
	gender: number = 0;
	roomId: number = 0;
	token: string = "";
	secret: string = "";
	image: string = "";


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setString(this.playerName, 2)
	writer.setUint8(this.gender, 3)
	writer.setUint32(this.roomId, 4)
	writer.setString(this.token, 5)
	writer.setString(this.secret, 6)
	writer.setString(this.image, 7)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.playerName = reader.getString(2)
	this.gender = reader.getUint8(3)
	this.roomId = reader.getUint32(4)
	this.token = reader.getString(5)
	this.secret = reader.getString(6)
	this.image = reader.getString(7)
}
}

// message Resp3003
export class Resp3003 {
	protoid: number = 3003;
	playerId: string = "";
	room = new RoomInfo();


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setMessage(2)
	this.room.Marshal(writer)
	writer.endSetMessage()
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	reader.getMessage(2)
	this.room.Unmarshal(reader)
	reader.endGetMessage()
}
}

// message Req3004
export class Req3004 {
	protoid: number = 3004;
	playerId: string = "";
	roomId: number = 0;
	token: string = "";


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setUint32(this.roomId, 2)
	writer.setString(this.token, 3)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.roomId = reader.getUint32(2)
	this.token = reader.getString(3)
}
}

// message Resp3004
export class Resp3004 {
	protoid: number = 3004;
	playerId: string = "";
	roomId: number = 0;


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setUint32(this.roomId, 2)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.roomId = reader.getUint32(2)
}
}

// message Resp3005
export class Resp3005 {
	protoid: number = 3005;
	player = new RoomPlayerInfo();
	roomId: number = 0;


Marshal(writer: any) {
	writer.setMessage(1)
	this.player.Marshal(writer)
	writer.endSetMessage()
	writer.setUint32(this.roomId, 2)
}

Unmarshal(reader: any) {
	reader.getMessage(1)
	this.player.Unmarshal(reader)
	reader.endGetMessage()
	this.roomId = reader.getUint32(2)
}
}

// message Req3006
export class Req3006 {
	protoid: number = 3006;
	playerId: string = "";


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
}
}

// message Resp3006
export class Resp3006 {
	protoid: number = 3006;
	playerId: string = "";


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
}
}

// message Req3007
export class Req3007 {
	protoid: number = 3007;
	roomId: number = 0;


Marshal(writer: any) {
	writer.setUint32(this.roomId, 1)
}

Unmarshal(reader: any) {
	this.roomId = reader.getUint32(1)
}
}

// message Req3008
export class Req3008 {
	protoid: number = 3008;
	playerId: string = "";
	option: number = 0;


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setUint8(this.option, 2)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.option = reader.getUint8(2)
}
}

// message Resp3008
export class Resp3008 {
	protoid: number = 3008;
	playerId: string = "";
	option: number = 0;
	pids: string[] = [];
	opts: number[] = [];
	dt: number = 0;
	result: number = 0;


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setUint8(this.option, 2)
	writer.setArray(this.pids.length, 3)
	for (let v of this.pids) {
		writer.setString(v, 0)
	}
	writer.setArray(this.opts.length, 4)
	for (let v of this.opts) {
		writer.setUint8(v, 0)
	}
	writer.setInt16(this.dt, 5)
	writer.setUint8(this.result, 6)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.option = reader.getUint8(2)
	let countPids = reader.getArray(3)
	for (let i=0; i < countPids; i++) {
		this.pids.push(reader.getString(0))
	}
	let countOpts = reader.getArray(4)
	for (let i=0; i < countOpts; i++) {
		this.opts.push(reader.getUint8(0))
	}
	this.dt = reader.getInt16(5)
	this.result = reader.getUint8(6)
}
}

// message Resp3009
export class Resp3009 {
	protoid: number = 3009;
	roomId: number = 0;


Marshal(writer: any) {
	writer.setUint32(this.roomId, 1)
}

Unmarshal(reader: any) {
	this.roomId = reader.getUint32(1)
}
}

// message GameRecordScore
export class GameRecordScore {
	protoid: number = 0;
	playerId: string = "";
	score: number = 0;
	playerName: string = "";


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setInt32(this.score, 2)
	writer.setString(this.playerName, 3)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.score = reader.getInt32(2)
	this.playerName = reader.getString(3)
}
}

// message GameRecord
export class GameRecord {
	protoid: number = 0;
	recordId: string = "";
	index: number = 0;
	scores: GameRecordScore[] = [];
	startTime: number = 0;


Marshal(writer: any) {
	writer.setString(this.recordId, 1)
	writer.setUint16(this.index, 2)
	writer.setArray(this.scores.length, 3)
	for (let v of this.scores) {
		writer.setMessage(0)
		v.Marshal(writer)
		writer.endSetMessage()
	}
	writer.setInt64(this.startTime, 4)
}

Unmarshal(reader: any) {
	this.recordId = reader.getString(1)
	this.index = reader.getUint16(2)
	let countScores = reader.getArray(3)
	for (let i=0; i < countScores; i++) {
		let msg = new GameRecordScore()
		reader.getMessage(0)
		msg.Unmarshal(reader)
		reader.endGetMessage()
		this.scores.push(msg)
	}
	this.startTime = reader.getInt64(4)
}
}

// message RoomRecord
export class RoomRecord {
	protoid: number = 0;
	recordId: string = "";
	roomId: number = 0;
	total: number = 0;
	records: GameRecord[] = [];
	startTime: number = 0;


Marshal(writer: any) {
	writer.setString(this.recordId, 1)
	writer.setUint32(this.roomId, 2)
	writer.setUint16(this.total, 3)
	writer.setArray(this.records.length, 4)
	for (let v of this.records) {
		writer.setMessage(0)
		v.Marshal(writer)
		writer.endSetMessage()
	}
	writer.setInt64(this.startTime, 5)
}

Unmarshal(reader: any) {
	this.recordId = reader.getString(1)
	this.roomId = reader.getUint32(2)
	this.total = reader.getUint16(3)
	let countRecords = reader.getArray(4)
	for (let i=0; i < countRecords; i++) {
		let msg = new GameRecord()
		reader.getMessage(0)
		msg.Unmarshal(reader)
		reader.endGetMessage()
		this.records.push(msg)
	}
	this.startTime = reader.getInt64(5)
}
}

// message Req3020
export class Req3020 {
	protoid: number = 3020;
	playerId: string = "";
	count: number = 0;


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setUint8(this.count, 2)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.count = reader.getUint8(2)
}
}

// message Resp3020
export class Resp3020 {
	protoid: number = 3020;
	playerId: string = "";
	records: RoomRecord[] = [];


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setArray(this.records.length, 2)
	for (let v of this.records) {
		writer.setMessage(0)
		v.Marshal(writer)
		writer.endSetMessage()
	}
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	let countRecords = reader.getArray(2)
	for (let i=0; i < countRecords; i++) {
		let msg = new RoomRecord()
		reader.getMessage(0)
		msg.Unmarshal(reader)
		reader.endGetMessage()
		this.records.push(msg)
	}
}
}

// message Req3021
export class Req3021 {
	protoid: number = 3021;
	playerId: string = "";
	recordId: string = "";


Marshal(writer: any) {
	writer.setString(this.playerId, 1)
	writer.setString(this.recordId, 2)
}

Unmarshal(reader: any) {
	this.playerId = reader.getString(1)
	this.recordId = reader.getString(2)
}
}

// message Resp3021
export class Resp3021 {
	protoid: number = 3021;
	recordId: string = "";
	record: string[] = [];


Marshal(writer: any) {
	writer.setString(this.recordId, 1)
	writer.setArray(this.record.length, 2)
	for (let v of this.record) {
		writer.setString(v, 0)
	}
}

Unmarshal(reader: any) {
	this.recordId = reader.getString(1)
	let countRecord = reader.getArray(2)
	for (let i=0; i < countRecord; i++) {
		this.record.push(reader.getString(0))
	}
}
}

